﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace DiplomNN
{
    public partial class AddNewImageForm : Form
    {
        private string PictureName;
        public AddNewImageForm()
        {
            InitializeComponent();
        }

        private void BAddPicture_Click(object sender, EventArgs e)
        {
            Helper.NameNewPicture = PictureName;
            string[] files = Directory.GetFiles(Helper.HopfildDirPath);
            string filename = Helper.HopfildDirPath + "\\" + PictureName + ".jpeg";
            FileStream fstream = new FileStream(filename, FileMode.Create);
            Helper.SaveImage.Save(fstream, System.Drawing.Imaging.ImageFormat.Jpeg);
            fstream.Close();
            TrainingForm.SelfRef.UpdatePanel();
            this.Close();
        }

        private void TBPictureName_TextChanged(object sender, EventArgs e)
        {
            PictureName = TBPictureName.Text;
        }

        private void BCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}
